﻿using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HMI.Header
{
    /// <summary>
    /// HeaderMenu.xaml 的交互逻辑
    /// </summary>
    public partial class HeaderMenu : UserControl
    {
        public HeaderMenu()
        {
            InitializeComponent();
            IsMesOnline = false;
            productLink.Visibility = Visibility.Hidden;
            datalab.Content = DateTime.Now.ToString();
        }
        bool isMesOnline = false;

        private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
        {

        }
        public bool IsMesOnline
        {
            get
            {
                return isMesOnline;
                //string mesonline = Convert.ToString(isonline.Content);
                //if (mesonline == "在线")
                //{
                //    return true;
                //}
                //else
                //{
                //    return false;
                //}
            }
            set
            {
                isMesOnline = value;
                if (value)
                {
                    Geometry geometry = (Geometry)Application.Current.Resources[$"FullSign"];
                    IconElement.SetGeometry(isonline, geometry);
                    //isonline.id.Content = "在线";
                    SolidColorBrush brushbfrx = FindResource("Lightx") as SolidColorBrush;
                    isonline.Foreground = brushbfrx;
                }
                else
                {
                    //isonline.Content = "离线";
                    Geometry geometry = (Geometry)Application.Current.Resources[$"EmptySign"];
                    IconElement.SetGeometry(isonline, geometry);
                    SolidColorBrush brushbfrx = FindResource("ForeColorx") as SolidColorBrush;
                    isonline.Foreground = brushbfrx;
                }
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        { }
        }
}
